package cn.gson.crm.model.pojos;

import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Objects;

@Entity
public class Offer {
    private long offerId;
    private Date offerDate;
    private String offerTimes;
    private String offerState;
    private String offerAudit;
    private double offerMoney;
    private Employee employee;
    private Sales sales;
    private List<OfferDetail> offerDetails;

    @OneToMany(mappedBy = "offerByOfferId")
    public List<OfferDetail> getOfferDetails() {
        return offerDetails;
    }

    public void setOfferDetails(List<OfferDetail> offerDetails) {
        this.offerDetails = offerDetails;
    }

    @ManyToOne
    @JoinColumn(name = "yg_id", referencedColumnName = "yg_id")
    public Employee getEmployee() {
        return employee;
    }

    public void setEmployee(Employee employee) {
        this.employee = employee;
    }

    @ManyToOne
    @JoinColumn(name = "sales_id2", referencedColumnName = "sales_id2")
    public Sales getSales() {
        return sales;
    }

    public void setSales(Sales sales) {
        this.sales = sales;
    }

    @Id
    @Column(name = "offer_id")
    @GeneratedValue(generator  =  "seq",strategy  =  GenerationType.SEQUENCE)
    //定义一个序列生成器
    @SequenceGenerator(name  =  "seq",sequenceName  =  "crm",
            initialValue  =  1,allocationSize  =  1)
    public long getOfferId() {
        return offerId;
    }

    public void setOfferId(long offerId) {
        this.offerId = offerId;
    }

    @Basic
    @Column(name = "offer_date")
    public Date getOfferDate() {
        return offerDate;
    }

    public void setOfferDate(Date offerDate) {
        this.offerDate = offerDate;
    }

    @Basic
    @Column(name = "offer_times")
    public String getOfferTimes() {
        return offerTimes;
    }

    public void setOfferTimes(String offerTimes) {
        this.offerTimes = offerTimes;
    }

    @Basic
    @Column(name = "offer_state")
    public String getOfferState() {
        return offerState;
    }

    public void setOfferState(String offerState) {
        this.offerState = offerState;
    }

    @Basic
    @Column(name = "offer_audit")
    public String getOfferAudit() {
        return offerAudit;
    }

    public void setOfferAudit(String offerAudit) {
        this.offerAudit = offerAudit;
    }

    @Basic
    @Column(name = "offer_money")
    public double getOfferMoney() {
        return offerMoney;
    }

    public void setOfferMoney(double offerMoney) {
        this.offerMoney = offerMoney;
    }
}
